import {
    createApp,
    h,
    defineAsyncComponent
} from 'vue'

const ALL = {
    Header: () => import('./compontents/Header.vue'),
    Main: () => import('./compontents/Main.vue'),
    Ad: () => import('./compontents/Ad.vue'),
    Footer: () => import('./compontents/Footer.vue')
}

function getComponentList() {
    return new Promise((resolve) => {
        resolve(['Header', 'Ad', 'Main', 'Ad', 'Footer'])
    })
}

getComponentList().then(res => {
    createApp({
        render: () => res.map(k => {
            const component = ALL[k]
            return component ? h(defineAsyncComponent(component)) : ''
        })
    }).mount('#app')
})